import sys
import os
from pprint import pprint


def curr(path):
    """取得脚本所在目录的相对位置"""
    exec = sys.argv[0]
    return os.path.join(os.path.dirname(exec), path)


def gen_blocks():
    """每次不超过1000个字"""
    with open(curr("4447.txt"), "rt", encoding="utf-8") as fin:
        while True:
            block = fin.read(80)
            if block:
                yield block
            else:
                break


blocks = gen_blocks()
pages = []


def read_page():
    page = next(blocks, None)
    if page:
        pages.append(page)
        print(page)
    else:
        print("读完了")


print("第1页")
read_page()

print("第2页")
read_page()

print("第3页")
read_page()
